package ch.reevolt.curchod.model;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class MyTableCellRender extends DefaultTableCellRenderer {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1424234151378387314L;

	public MyTableCellRender() {
		super();
	}

	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
			int row, int column) {

		if (table.getValueAt(row, 4).toString() == "Sortie" || table.getValueAt(row, 2).toString() == "Sortie") {
			setBackground(new Color(255, 193, 193));
		} else {
			setBackground(new Color(202, 255, 112));
		}

		setText(value != null ? value.toString() : "");
		return this;
	}
}